<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

    <title>cup package &#8212; cup 3.2.33 documentation</title>
    <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
    <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/sphinx_highlight.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="cup.net package" href="cup.net.html" />
    <link rel="prev" title="Welcome to cup’s documentation!" href="index.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <section id="module-cup">
<span id="cup-package"></span><h1>cup package<a class="headerlink" href="#module-cup" title="Permalink to this heading">¶</a></h1>
<p>&#64;author Guannan Ma</p>
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this heading">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="cup.net.html">cup.net package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.get_hostip"><code class="docutils literal notranslate"><span class="pre">get_hostip()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.get_interfaces"><code class="docutils literal notranslate"><span class="pre">get_interfaces()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.get_local_hostname"><code class="docutils literal notranslate"><span class="pre">get_local_hostname()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.getip_byinterface"><code class="docutils literal notranslate"><span class="pre">getip_byinterface()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.localport_free"><code class="docutils literal notranslate"><span class="pre">localport_free()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.port_listened"><code class="docutils literal notranslate"><span class="pre">port_listened()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.set_sock_keepalive_linux"><code class="docutils literal notranslate"><span class="pre">set_sock_keepalive_linux()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.set_sock_linger"><code class="docutils literal notranslate"><span class="pre">set_sock_linger()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.set_sock_quickack"><code class="docutils literal notranslate"><span class="pre">set_sock_quickack()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#cup.net.set_sock_reusable"><code class="docutils literal notranslate"><span class="pre">set_sock_reusable()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.net.asyn.html">cup.net.asyn package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#module-cup.net.asyn.common">cup.net.asyn.common module</a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#module-cup.net.asyn.conn">cup.net.asyn.conn module</a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#module-cup.net.asyn.context">cup.net.asyn.context module</a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#module-cup.net.asyn.ioloop">cup.net.asyn.ioloop module</a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#module-cup.net.asyn.msg">cup.net.asyn.msg module</a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.asyn.html#module-cup.net.asyn.msgcenter">cup.net.asyn.msgcenter module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#module-cup.net.ipaddr">cup.net.ipaddr module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.net.html#cup.net.ipaddr.realip_v4"><code class="docutils literal notranslate"><span class="pre">realip_v4()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.net.html#module-cup.net.route">cup.net.route module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.net.html#cup.net.route.RouteInfo"><code class="docutils literal notranslate"><span class="pre">RouteInfo</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.net.html#cup.net.route.RouteInfo.ROUTE_FILE"><code class="docutils literal notranslate"><span class="pre">RouteInfo.ROUTE_FILE</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.html#cup.net.route.RouteInfo.get_interface_by_ip"><code class="docutils literal notranslate"><span class="pre">RouteInfo.get_interface_by_ip()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.html#cup.net.route.RouteInfo.get_interfaces"><code class="docutils literal notranslate"><span class="pre">RouteInfo.get_interfaces()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.html#cup.net.route.RouteInfo.get_route_by_ip"><code class="docutils literal notranslate"><span class="pre">RouteInfo.get_route_by_ip()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.net.html#cup.net.route.RouteInfo.get_routes"><code class="docutils literal notranslate"><span class="pre">RouteInfo.get_routes()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cup.res.html">cup.res package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cup.res.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.res.html#module-cup.res.linux">cup.res.linux module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.CPUInfo"><code class="docutils literal notranslate"><span class="pre">CPUInfo</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.MemInfo"><code class="docutils literal notranslate"><span class="pre">MemInfo</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.Process"><code class="docutils literal notranslate"><span class="pre">Process</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.children"><code class="docutils literal notranslate"><span class="pre">Process.children()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.create_time"><code class="docutils literal notranslate"><span class="pre">Process.create_time()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_connections"><code class="docutils literal notranslate"><span class="pre">Process.get_connections()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_cpu_times"><code class="docutils literal notranslate"><span class="pre">Process.get_cpu_times()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_cpu_usage"><code class="docutils literal notranslate"><span class="pre">Process.get_cpu_usage()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_ext_memory_info"><code class="docutils literal notranslate"><span class="pre">Process.get_ext_memory_info()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_memory_info"><code class="docutils literal notranslate"><span class="pre">Process.get_memory_info()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_memory_maps"><code class="docutils literal notranslate"><span class="pre">Process.get_memory_maps()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_num_ctx_switches"><code class="docutils literal notranslate"><span class="pre">Process.get_num_ctx_switches()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_num_fds"><code class="docutils literal notranslate"><span class="pre">Process.get_num_fds()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_open_files"><code class="docutils literal notranslate"><span class="pre">Process.get_open_files()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_cmdline"><code class="docutils literal notranslate"><span class="pre">Process.get_process_cmdline()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_create_time"><code class="docutils literal notranslate"><span class="pre">Process.get_process_create_time()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_cwd"><code class="docutils literal notranslate"><span class="pre">Process.get_process_cwd()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_exe"><code class="docutils literal notranslate"><span class="pre">Process.get_process_exe()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_gids"><code class="docutils literal notranslate"><span class="pre">Process.get_process_gids()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_io_counters"><code class="docutils literal notranslate"><span class="pre">Process.get_process_io_counters()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_name"><code class="docutils literal notranslate"><span class="pre">Process.get_process_name()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_nice"><code class="docutils literal notranslate"><span class="pre">Process.get_process_nice()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_num_threads"><code class="docutils literal notranslate"><span class="pre">Process.get_process_num_threads()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_ppid"><code class="docutils literal notranslate"><span class="pre">Process.get_process_ppid()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_status"><code class="docutils literal notranslate"><span class="pre">Process.get_process_status()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_threads"><code class="docutils literal notranslate"><span class="pre">Process.get_process_threads()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.get_process_uids"><code class="docutils literal notranslate"><span class="pre">Process.get_process_uids()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.getpgid"><code class="docutils literal notranslate"><span class="pre">Process.getpgid()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.nt_mmap_ext"><code class="docutils literal notranslate"><span class="pre">Process.nt_mmap_ext</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.nt_mmap_grouped"><code class="docutils literal notranslate"><span class="pre">Process.nt_mmap_grouped</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.res.html#cup.res.linux.Process.pid"><code class="docutils literal notranslate"><span class="pre">Process.pid</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.SWAPINFO"><code class="docutils literal notranslate"><span class="pre">SWAPINFO</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.boot_time"><code class="docutils literal notranslate"><span class="pre">boot_time()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_boottime_since_epoch"><code class="docutils literal notranslate"><span class="pre">get_boottime_since_epoch()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_cpu_core_usage"><code class="docutils literal notranslate"><span class="pre">get_cpu_core_usage()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_cpu_nums"><code class="docutils literal notranslate"><span class="pre">get_cpu_nums()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_cpu_usage"><code class="docutils literal notranslate"><span class="pre">get_cpu_usage()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_disk_info"><code class="docutils literal notranslate"><span class="pre">get_disk_info()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_disk_usage_all"><code class="docutils literal notranslate"><span class="pre">get_disk_usage_all()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_kernel_version"><code class="docutils literal notranslate"><span class="pre">get_kernel_version()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_meminfo"><code class="docutils literal notranslate"><span class="pre">get_meminfo()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_net_through"><code class="docutils literal notranslate"><span class="pre">get_net_through()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_net_transmit_speed"><code class="docutils literal notranslate"><span class="pre">get_net_transmit_speed()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.get_swapinfo"><code class="docutils literal notranslate"><span class="pre">get_swapinfo()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.net_io_counters"><code class="docutils literal notranslate"><span class="pre">net_io_counters()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.pids"><code class="docutils literal notranslate"><span class="pre">pids()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.linux.process_iter"><code class="docutils literal notranslate"><span class="pre">process_iter()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.res.html#module-cup.res.mac">cup.res.mac module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.mac.get_cpu_nums"><code class="docutils literal notranslate"><span class="pre">get_cpu_nums()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.mac.get_disk_info"><code class="docutils literal notranslate"><span class="pre">get_disk_info()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.mac.get_disk_usage_all"><code class="docutils literal notranslate"><span class="pre">get_disk_usage_all()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html#cup.res.mac.get_kernel_version"><code class="docutils literal notranslate"><span class="pre">get_kernel_version()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cup.services.html">cup.services package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.autowait">cup.services.autowait module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_file_exist"><code class="docutils literal notranslate"><span class="pre">wait_until_file_exist()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_port_not_used"><code class="docutils literal notranslate"><span class="pre">wait_until_port_not_used()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_port_used"><code class="docutils literal notranslate"><span class="pre">wait_until_port_used()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_process_exist"><code class="docutils literal notranslate"><span class="pre">wait_until_process_exist()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_process_killed"><code class="docutils literal notranslate"><span class="pre">wait_until_process_killed()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_process_not_exist"><code class="docutils literal notranslate"><span class="pre">wait_until_process_not_exist()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_process_used_ports"><code class="docutils literal notranslate"><span class="pre">wait_until_process_used_ports()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.autowait.wait_until_reg_str_exist"><code class="docutils literal notranslate"><span class="pre">wait_until_reg_str_exist()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.buffers">cup.services.buffers module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer"><code class="docutils literal notranslate"><span class="pre">Buffer</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer.get"><code class="docutils literal notranslate"><span class="pre">Buffer.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer.get_byte_arrays"><code class="docutils literal notranslate"><span class="pre">Buffer.get_byte_arrays()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer.get_uniq_id"><code class="docutils literal notranslate"><span class="pre">Buffer.get_uniq_id()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer.length"><code class="docutils literal notranslate"><span class="pre">Buffer.length()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer.maxsize"><code class="docutils literal notranslate"><span class="pre">Buffer.maxsize()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.Buffer.set"><code class="docutils literal notranslate"><span class="pre">Buffer.set()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.buffers.BufferPool"><code class="docutils literal notranslate"><span class="pre">BufferPool</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.BufferPool.allocate"><code class="docutils literal notranslate"><span class="pre">BufferPool.allocate()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.buffers.BufferPool.deallocate"><code class="docutils literal notranslate"><span class="pre">BufferPool.deallocate()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.executor">cup.services.executor module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.executor.AbstractExecution"><code class="docutils literal notranslate"><span class="pre">AbstractExecution</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.AbstractExecution.delay_exec"><code class="docutils literal notranslate"><span class="pre">AbstractExecution.delay_exec()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.AbstractExecution.exec_worker"><code class="docutils literal notranslate"><span class="pre">AbstractExecution.exec_worker()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution"><code class="docutils literal notranslate"><span class="pre">CronExecution</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution.calcel_delay_exec"><code class="docutils literal notranslate"><span class="pre">CronExecution.calcel_delay_exec()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution.delay_exec"><code class="docutils literal notranslate"><span class="pre">CronExecution.delay_exec()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution.exec_worker"><code class="docutils literal notranslate"><span class="pre">CronExecution.exec_worker()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution.get_taskbyid"><code class="docutils literal notranslate"><span class="pre">CronExecution.get_taskbyid()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution.get_tasks"><code class="docutils literal notranslate"><span class="pre">CronExecution.get_tasks()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronExecution.schedule"><code class="docutils literal notranslate"><span class="pre">CronExecution.schedule()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask"><code class="docutils literal notranslate"><span class="pre">CronTask</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.check_monthday_weekday"><code class="docutils literal notranslate"><span class="pre">CronTask.check_monthday_weekday()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.get_funcargs"><code class="docutils literal notranslate"><span class="pre">CronTask.get_funcargs()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.get_last_schedtime"><code class="docutils literal notranslate"><span class="pre">CronTask.get_last_schedtime()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.get_timer"><code class="docutils literal notranslate"><span class="pre">CronTask.get_timer()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.last_schedtime"><code class="docutils literal notranslate"><span class="pre">CronTask.last_schedtime()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.name"><code class="docutils literal notranslate"><span class="pre">CronTask.name()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.next_hour"><code class="docutils literal notranslate"><span class="pre">CronTask.next_hour()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.next_minute"><code class="docutils literal notranslate"><span class="pre">CronTask.next_minute()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.next_month"><code class="docutils literal notranslate"><span class="pre">CronTask.next_month()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.next_monthday_weekday"><code class="docutils literal notranslate"><span class="pre">CronTask.next_monthday_weekday()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.next_schedtime"><code class="docutils literal notranslate"><span class="pre">CronTask.next_schedtime()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.pytz_timezone"><code class="docutils literal notranslate"><span class="pre">CronTask.pytz_timezone()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.set_last_schedtime"><code class="docutils literal notranslate"><span class="pre">CronTask.set_last_schedtime()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.set_timer"><code class="docutils literal notranslate"><span class="pre">CronTask.set_timer()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.CronTask.taskid"><code class="docutils literal notranslate"><span class="pre">CronTask.taskid()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService"><code class="docutils literal notranslate"><span class="pre">ExecutionService</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService.delay_exec"><code class="docutils literal notranslate"><span class="pre">ExecutionService.delay_exec()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService.exec_worker"><code class="docutils literal notranslate"><span class="pre">ExecutionService.exec_worker()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService.queue_exec"><code class="docutils literal notranslate"><span class="pre">ExecutionService.queue_exec()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService.run"><code class="docutils literal notranslate"><span class="pre">ExecutionService.run()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService.start"><code class="docutils literal notranslate"><span class="pre">ExecutionService.start()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.executor.ExecutionService.stop"><code class="docutils literal notranslate"><span class="pre">ExecutionService.stop()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.generator">cup.services.generator module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#class-cgeneratorman-object">class CGeneratorMan(object)</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.generator.CycleIDGenerator"><code class="docutils literal notranslate"><span class="pre">CycleIDGenerator</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.generator.CycleIDGenerator.id2_hexstring"><code class="docutils literal notranslate"><span class="pre">CycleIDGenerator.id2_hexstring()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.generator.CycleIDGenerator.next_id"><code class="docutils literal notranslate"><span class="pre">CycleIDGenerator.next_id()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.generator.CycleIDGenerator.reset_nextid"><code class="docutils literal notranslate"><span class="pre">CycleIDGenerator.reset_nextid()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.heartbeat">cup.services.heartbeat module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device"><code class="docutils literal notranslate"><span class="pre">Device</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device.deserilize"><code class="docutils literal notranslate"><span class="pre">Device.deserilize()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device.get_dict_resinfo"><code class="docutils literal notranslate"><span class="pre">Device.get_dict_resinfo()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device.get_last_healthy"><code class="docutils literal notranslate"><span class="pre">Device.get_last_healthy()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device.get_name"><code class="docutils literal notranslate"><span class="pre">Device.get_name()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device.serilize"><code class="docutils literal notranslate"><span class="pre">Device.serilize()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.Device.set_last_healthy"><code class="docutils literal notranslate"><span class="pre">Device.set_last_healthy()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.HeartbeatService"><code class="docutils literal notranslate"><span class="pre">HeartbeatService</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.HeartbeatService.adjust_judge_lost_time"><code class="docutils literal notranslate"><span class="pre">HeartbeatService.adjust_judge_lost_time()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.HeartbeatService.cleanup_oldlost"><code class="docutils literal notranslate"><span class="pre">HeartbeatService.cleanup_oldlost()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.HeartbeatService.get_lost"><code class="docutils literal notranslate"><span class="pre">HeartbeatService.get_lost()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.HeartbeatService.is_device_registered"><code class="docutils literal notranslate"><span class="pre">HeartbeatService.is_device_registered()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.HeartbeatService.refresh"><code class="docutils literal notranslate"><span class="pre">HeartbeatService.refresh()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost"><code class="docutils literal notranslate"><span class="pre">LinuxHost</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.get_cpu_idle"><code class="docutils literal notranslate"><span class="pre">LinuxHost.get_cpu_idle()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.get_ip"><code class="docutils literal notranslate"><span class="pre">LinuxHost.get_ip()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.get_ip_port"><code class="docutils literal notranslate"><span class="pre">LinuxHost.get_ip_port()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.get_mem_info"><code class="docutils literal notranslate"><span class="pre">LinuxHost.get_mem_info()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.get_net_usage"><code class="docutils literal notranslate"><span class="pre">LinuxHost.get_net_usage()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.set_cpu_idle"><code class="docutils literal notranslate"><span class="pre">LinuxHost.set_cpu_idle()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.set_ip_port"><code class="docutils literal notranslate"><span class="pre">LinuxHost.set_ip_port()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.set_linux_res_bydict"><code class="docutils literal notranslate"><span class="pre">LinuxHost.set_linux_res_bydict()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.set_mem_usage"><code class="docutils literal notranslate"><span class="pre">LinuxHost.set_mem_usage()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.LinuxHost.set_net_usage"><code class="docutils literal notranslate"><span class="pre">LinuxHost.set_net_usage()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.MacHost"><code class="docutils literal notranslate"><span class="pre">MacHost</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.RestrictedUnpickler"><code class="docutils literal notranslate"><span class="pre">RestrictedUnpickler</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.RestrictedUnpickler.find_class"><code class="docutils literal notranslate"><span class="pre">RestrictedUnpickler.find_class()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.heartbeat.restricted_loads"><code class="docutils literal notranslate"><span class="pre">restricted_loads()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.msgbroker">cup.services.msgbroker module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.BrokerCenter"><code class="docutils literal notranslate"><span class="pre">BrokerCenter</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.BrokerCenter.comsume_msg"><code class="docutils literal notranslate"><span class="pre">BrokerCenter.comsume_msg()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.BrokerCenter.produce_msg"><code class="docutils literal notranslate"><span class="pre">BrokerCenter.produce_msg()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.clean_data"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.clean_data()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.fatal_alert"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.fatal_alert()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.get_fatal_alerts"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.get_fatal_alerts()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.need_stop"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.need_stop()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.register_msg"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.register_msg()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.register_msgtype_callback"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.register_msgtype_callback()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.register_wakeup"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.register_wakeup()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.msgbroker.SystemErrmsgBroker.warnning_alert"><code class="docutils literal notranslate"><span class="pre">SystemErrmsgBroker.warnning_alert()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.serializer">cup.services.serializer module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.add_log"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.add_log()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.close_read"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.close_read()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.close_write"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.close_write()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.get_subdir"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.get_subdir()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.is_empty"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.is_empty()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.is_stream_wbopen"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.is_stream_wbopen()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.open4read"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.open4read()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.open4write"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.open4write()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.purge_data"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.purge_data()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.read"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.read()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.set_current_logid"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.set_current_logid()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.set_name"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.set_name()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LocalFileSerilizer.switch_logfilelist"><code class="docutils literal notranslate"><span class="pre">LocalFileSerilizer.switch_logfilelist()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.serializer.LogRecord"><code class="docutils literal notranslate"><span class="pre">LogRecord</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LogRecord.length"><code class="docutils literal notranslate"><span class="pre">LogRecord.length</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LogRecord.log_binary"><code class="docutils literal notranslate"><span class="pre">LogRecord.log_binary</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LogRecord.log_id"><code class="docutils literal notranslate"><span class="pre">LogRecord.log_id</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LogRecord.log_mode"><code class="docutils literal notranslate"><span class="pre">LogRecord.log_mode</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.serializer.LogRecord.log_type"><code class="docutils literal notranslate"><span class="pre">LogRecord.log_type</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.services.html#module-cup.services.threadpool">cup.services.threadpool module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool"><code class="docutils literal notranslate"><span class="pre">ThreadPool</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.add_1job"><code class="docutils literal notranslate"><span class="pre">ThreadPool.add_1job()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.add_1job_with_callback"><code class="docutils literal notranslate"><span class="pre">ThreadPool.add_1job_with_callback()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.adjust_poolsize"><code class="docutils literal notranslate"><span class="pre">ThreadPool.adjust_poolsize()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.dump_stats"><code class="docutils literal notranslate"><span class="pre">ThreadPool.dump_stats()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.get_stats"><code class="docutils literal notranslate"><span class="pre">ThreadPool.get_stats()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.start"><code class="docutils literal notranslate"><span class="pre">ThreadPool.start()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.start1worker"><code class="docutils literal notranslate"><span class="pre">ThreadPool.start1worker()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.stop"><code class="docutils literal notranslate"><span class="pre">ThreadPool.stop()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.stop1worker"><code class="docutils literal notranslate"><span class="pre">ThreadPool.stop1worker()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.services.html#cup.services.threadpool.ThreadPool.try_stop"><code class="docutils literal notranslate"><span class="pre">ThreadPool.try_stop()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cup.shell.html">cup.shell package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cup.shell.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.shell.html#module-cup.shell.expect">cup.shell.expect module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.expect.checkssh"><code class="docutils literal notranslate"><span class="pre">checkssh()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.expect.dscp"><code class="docutils literal notranslate"><span class="pre">dscp()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.expect.go_ex"><code class="docutils literal notranslate"><span class="pre">go_ex()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.expect.go_with_scp"><code class="docutils literal notranslate"><span class="pre">go_with_scp()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.expect.lscp"><code class="docutils literal notranslate"><span class="pre">lscp()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.shell.html#module-cup.shell.oper">cup.shell.oper module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.oper.backup_file"><code class="docutils literal notranslate"><span class="pre">backup_file()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html#cup.shell.oper.contains_file"><code class="docutils literal notranslate"><span class="pre">contains_file()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cup.storage.html">cup.storage package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cup.storage.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.storage.html#module-cup.storage.obj">cup.storage.obj module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.delete"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.delete()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.get"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.head"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.head()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.mkdir"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.mkdir()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.put"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.put()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.rename"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.rename()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.AFSObjectSystem.rmdir"><code class="docutils literal notranslate"><span class="pre">AFSObjectSystem.rmdir()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.delete"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.delete()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.get"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.head"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.head()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.is_file"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.is_file()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.mkdir"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.mkdir()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.put"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.put()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.rename"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.rename()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.FTPObjectSystem.rmdir"><code class="docutils literal notranslate"><span class="pre">FTPObjectSystem.rmdir()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.delete"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.delete()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.get"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.head"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.head()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.mkdir"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.mkdir()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.put"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.put()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.rename"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.rename()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.LocalObjectSystem.rmdir"><code class="docutils literal notranslate"><span class="pre">LocalObjectSystem.rmdir()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.create_bucket"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.create_bucket()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.delete"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.delete()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.delete_bucket"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.delete_bucket()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.get"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.head"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.head()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.head_bucket"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.head_bucket()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.mkdir"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.mkdir()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.put"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.put()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.rename"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.rename()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.storage.html#cup.storage.obj.S3ObjectSystem.rmdir"><code class="docutils literal notranslate"><span class="pre">S3ObjectSystem.rmdir()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cup.util.html">cup.util package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#cup.util.check_not_none"><code class="docutils literal notranslate"><span class="pre">check_not_none()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#cup.util.check_type"><code class="docutils literal notranslate"><span class="pre">check_type()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#module-cup.util.conf">cup.util.conf module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.conf.Configure2Dict"><code class="docutils literal notranslate"><span class="pre">Configure2Dict</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.conf.Configure2Dict.get_dict"><code class="docutils literal notranslate"><span class="pre">Configure2Dict.get_dict()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.conf.Dict2Configure"><code class="docutils literal notranslate"><span class="pre">Dict2Configure</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.conf.Dict2Configure.set_dict"><code class="docutils literal notranslate"><span class="pre">Dict2Configure.set_dict()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.conf.Dict2Configure.write_conf"><code class="docutils literal notranslate"><span class="pre">Dict2Configure.write_conf()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.conf.HdfsXmlConf"><code class="docutils literal notranslate"><span class="pre">HdfsXmlConf</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.conf.HdfsXmlConf.get_items"><code class="docutils literal notranslate"><span class="pre">HdfsXmlConf.get_items()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.conf.HdfsXmlConf.write_conf"><code class="docutils literal notranslate"><span class="pre">HdfsXmlConf.write_conf()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#module-cup.util.constants">cup.util.constants module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.constants.FlagConstant"><code class="docutils literal notranslate"><span class="pre">FlagConstant</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.constants.Flags"><code class="docutils literal notranslate"><span class="pre">Flags</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.constants.NamedConstant"><code class="docutils literal notranslate"><span class="pre">NamedConstant</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.constants.Names"><code class="docutils literal notranslate"><span class="pre">Names</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.constants.ValueConstant"><code class="docutils literal notranslate"><span class="pre">ValueConstant</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.constants.Values"><code class="docutils literal notranslate"><span class="pre">Values</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.constants.Values.lookupByValue"><code class="docutils literal notranslate"><span class="pre">Values.lookupByValue()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#module-cup.util.context">cup.util.context module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.context.ContextManager"><code class="docutils literal notranslate"><span class="pre">ContextManager</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.context.ContextManager.call_with_context"><code class="docutils literal notranslate"><span class="pre">ContextManager.call_with_context()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.context.ContextManager.get_context"><code class="docutils literal notranslate"><span class="pre">ContextManager.get_context()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.context.ContextTracker4Thread"><code class="docutils literal notranslate"><span class="pre">ContextTracker4Thread</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.context.ContextTracker4Thread.call_with_context"><code class="docutils literal notranslate"><span class="pre">ContextTracker4Thread.call_with_context()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.context.ContextTracker4Thread.current_context"><code class="docutils literal notranslate"><span class="pre">ContextTracker4Thread.current_context()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.context.ContextTracker4Thread.get_context"><code class="docutils literal notranslate"><span class="pre">ContextTracker4Thread.get_context()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#module-cup.util.misc">cup.util.misc module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.misc.CAck"><code class="docutils literal notranslate"><span class="pre">CAck</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.misc.CAck.getack_infobool"><code class="docutils literal notranslate"><span class="pre">CAck.getack_infobool()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="cup.util.html#cup.util.misc.CAck.setack_infobool"><code class="docutils literal notranslate"><span class="pre">CAck.setack_infobool()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.misc.check_not_none"><code class="docutils literal notranslate"><span class="pre">check_not_none()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.misc.check_type"><code class="docutils literal notranslate"><span class="pre">check_type()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.misc.get_filename"><code class="docutils literal notranslate"><span class="pre">get_filename()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.misc.get_funcname"><code class="docutils literal notranslate"><span class="pre">get_funcname()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.misc.get_lineno"><code class="docutils literal notranslate"><span class="pre">get_lineno()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cup.util.html#module-cup.util.typechecker">cup.util.typechecker module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.typechecker.check_not_none"><code class="docutils literal notranslate"><span class="pre">check_not_none()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.typechecker.check_type"><code class="docutils literal notranslate"><span class="pre">check_type()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.typechecker.raise_error"><code class="docutils literal notranslate"><span class="pre">raise_error()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html#cup.util.typechecker.raise_ifnone"><code class="docutils literal notranslate"><span class="pre">raise_ifnone()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cup.web.html">cup.web package</a></li>
</ul>
</div>
</section>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading">¶</a></h2>
</section>
<section id="module-cup.cache">
<span id="cup-cache-module"></span><h2>cup.cache module<a class="headerlink" href="#module-cup.cache" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>decorators related module</p>
</dd>
</dl>
<dl class="py exception">
<dt class="sig sig-object py" id="cup.cache.CacheFull">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.cache.</span></span><span class="sig-name descname"><span class="pre">CacheFull</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#CacheFull"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.CacheFull" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>CacheFull for cache.KvCache</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cup.cache.KVCache">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.cache.</span></span><span class="sig-name descname"><span class="pre">KVCache</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_extension</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Key-Value Cache object.</p>
<p>You can use function set/get to access KeyValue Cache.</p>
<p>When a k-v is hit by function <strong>get</strong>,
the expire_sec will be expanded to 2 * (expire_sec)</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="cup.cache.KVCache.INFINITE_TIME">
<span class="sig-name descname"><span class="pre">INFINITE_TIME</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">315360000000</span></em><a class="headerlink" href="#cup.cache.KVCache.INFINITE_TIME" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="cup.cache.KVCache.TIME_EXTENSION">
<span class="sig-name descname"><span class="pre">TIME_EXTENSION</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">300</span></em><a class="headerlink" href="#cup.cache.KVCache.TIME_EXTENSION" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.cache.KVCache.clear">
<span class="sig-name descname"><span class="pre">clear</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache.clear"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>remove all kv cache inside.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.cache.KVCache.get">
<span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache.get"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get your cache with key.
If the cache is expired, it will return None.
If the key does not exist, it will return None.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.cache.KVCache.pop_n_expired">
<span class="sig-name descname"><span class="pre">pop_n_expired</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">num</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache.pop_n_expired"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache.pop_n_expired" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>num</strong> – if num is 0, will get all expired key/values</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><p>A dict.
Return expired items. Return type is a dict</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s1">&#39;key&#39;</span> <span class="p">:</span> <span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">expire_time</span><span class="p">)</span>
<span class="p">}</span>
</pre></div>
</div>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.cache.KVCache.set">
<span class="sig-name descname"><span class="pre">set</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">kvdict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expire_sec</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache.set"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache.set" title="Permalink to this definition">¶</a></dt>
<dd><p>set cache with kvdict</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s1">&#39;key1&#39;</span><span class="p">:</span> <span class="s1">&#39;value1&#39;</span><span class="p">,</span>
    <span class="s1">&#39;key2&#39;</span><span class="p">:</span> <span class="s1">&#39;value2&#39;</span><span class="p">,</span>
    <span class="o">....</span>
<span class="p">}</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>kvdict</strong> – kvdict is a dict that contains your cache.</p></li>
<li><p><strong>expire_sec</strong> – if expire_sec is None, the cache will never expire.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>True if set cache successfully. False otherwise.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.cache.KVCache.set_time_extension">
<span class="sig-name descname"><span class="pre">set_time_extension</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">time_extension</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache.set_time_extension"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache.set_time_extension" title="Permalink to this definition">¶</a></dt>
<dd><p>set time extension</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.cache.KVCache.size">
<span class="sig-name descname"><span class="pre">size</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/cache.html#KVCache.size"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.cache.KVCache.size" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>cached item size</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="cup.cache.KvCache">
<span class="sig-prename descclassname"><span class="pre">cup.cache.</span></span><span class="sig-name descname"><span class="pre">KvCache</span></span><a class="headerlink" href="#cup.cache.KvCache" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#cup.cache.KVCache" title="cup.cache.KVCache"><code class="xref py py-class docutils literal notranslate"><span class="pre">KVCache</span></code></a></p>
</dd></dl>

</section>
<section id="module-cup.const">
<span id="cup-const-module"></span><h2>cup.const module<a class="headerlink" href="#module-cup.const" title="Permalink to this heading">¶</a></h2>
<p>internal const class</p>
<dl class="py exception">
<dt class="sig sig-object py" id="cup.const.ConstError">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.const.</span></span><span class="sig-name descname"><span class="pre">ConstError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cup.const.ConstError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>const error</p>
</dd></dl>

</section>
<section id="module-cup.decorators">
<span id="cup-decorators-module"></span><h2>cup.decorators module<a class="headerlink" href="#module-cup.decorators" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>decorators related module</p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.decorators.Singleton">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.decorators.</span></span><span class="sig-name descname"><span class="pre">Singleton</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/decorators.html#Singleton"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.decorators.Singleton" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Make your class singeton</p>
<p>example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">decorators</span>

<span class="nd">@decorators</span><span class="o">.</span><span class="n">Singleton</span>
<span class="k">class</span> <span class="nc">YourClass</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="k">pass</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cup.decorators.TraceUsedTime">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.decorators.</span></span><span class="sig-name descname"><span class="pre">TraceUsedTime</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">b_print_stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">enter_msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">leave_msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/decorators.html#TraceUsedTime"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.decorators.TraceUsedTime" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Trace used time inside a function.</p>
<p>Will print to LOGFILE if you initialized logging with cup.log.init_comlog.</p>
<p>example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">time</span>

<span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">decorators</span>

<span class="nd">@decorators</span><span class="o">.</span><span class="n">TraceUsedTime</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">test</span><span class="p">():</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;test&#39;</span><span class="p">)</span>
    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>


<span class="c1"># trace something with context. E.g. event_id</span>
<span class="k">def</span> <span class="nf">_test_trace_time_map</span><span class="p">(</span><span class="n">sleep_time</span><span class="p">):</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;ready to work&#39;</span><span class="p">)</span>
    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="n">sleep_time</span><span class="p">)</span>


<span class="n">traced_test_trace_time_map</span> <span class="o">=</span> <span class="n">decorators</span><span class="o">.</span><span class="n">TraceUsedTime</span><span class="p">(</span>
    <span class="n">b_print_stdout</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
    <span class="n">enter_msg</span><span class="o">=</span><span class="s1">&#39;event_id: 0x12345&#39;</span><span class="p">,</span>
    <span class="n">leave_msg</span><span class="o">=</span><span class="s1">&#39;event_id: 0x12345&#39;</span>
<span class="p">)(</span><span class="n">_test_trace_time_map</span><span class="p">)</span>
<span class="n">traced_test_trace_time_map</span><span class="p">(</span><span class="n">sleep_time</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.decorators.needlinux">
<span class="sig-prename descclassname"><span class="pre">cup.decorators.</span></span><span class="sig-name descname"><span class="pre">needlinux</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/decorators.html#needlinux"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.decorators.needlinux" title="Permalink to this definition">¶</a></dt>
<dd><p>make sure the func is only used on linux.
Raise cup.err.DecoratorException otherwise.</p>
<dl class="field-list simple">
<dt class="field-odd">Platform<span class="colon">:</span></dt>
<dd class="field-odd"><p>Linux</p>
</dd>
</dl>
<p>example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">decorators</span>
<span class="nd">@decorators</span><span class="o">.</span><span class="n">needlinux</span>
<span class="k">def</span> <span class="nf">your_func</span><span class="p">():</span>
    <span class="k">pass</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.decorators.needmac">
<span class="sig-prename descclassname"><span class="pre">cup.decorators.</span></span><span class="sig-name descname"><span class="pre">needmac</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/decorators.html#needmac"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.decorators.needmac" title="Permalink to this definition">¶</a></dt>
<dd><p>only support macOS</p>
<dl class="field-list simple">
<dt class="field-odd">Platform<span class="colon">:</span></dt>
<dd class="field-odd"><p>macOS</p>
</dd>
</dl>
<p>example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">decorators</span>
<span class="nd">@decorators</span><span class="o">.</span><span class="n">needmac</span>
<span class="k">def</span> <span class="nf">your_func</span><span class="p">():</span>
    <span class="k">pass</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.decorators.needposix">
<span class="sig-prename descclassname"><span class="pre">cup.decorators.</span></span><span class="sig-name descname"><span class="pre">needposix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/decorators.html#needposix"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.decorators.needposix" title="Permalink to this definition">¶</a></dt>
<dd><p>only support posix</p>
<dl class="field-list simple">
<dt class="field-odd">Platform<span class="colon">:</span></dt>
<dd class="field-odd"><p>Posix compatible</p>
</dd>
</dl>
<p>example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">decorators</span>
<span class="nd">@decorators</span><span class="o">.</span><span class="n">needposix</span>
<span class="k">def</span> <span class="nf">your_func</span><span class="p">():</span>
    <span class="k">pass</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.decorators.py_versioncheck">
<span class="sig-prename descclassname"><span class="pre">cup.decorators.</span></span><span class="sig-name descname"><span class="pre">py_versioncheck</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">version</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/decorators.html#py_versioncheck"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.decorators.py_versioncheck" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Platform<span class="colon">:</span></dt>
<dd class="field-odd"><p>any platform + any functions in python</p>
</dd>
<dt class="field-even">Parameters<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>version</strong> – The python on the OS should be &gt;= param version.
<em>E.g. version=(‘2’, ‘7’, ‘0’)</em>
OS python version should &gt;= 2.7.0</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.err">
<span id="cup-err-module"></span><h2>cup.err module<a class="headerlink" href="#module-cup.err" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>error related module</p>
</dd>
</dl>
<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.AccessDenied">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">AccessDenied</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">str_resouce</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#AccessDenied"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.AccessDenied" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.ResException" title="cup.err.ResException"><code class="xref py py-class docutils literal notranslate"><span class="pre">ResException</span></code></a></p>
<p>Access Denied</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.AsyncMsgError">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">AsyncMsgError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#AsyncMsgError"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.AsyncMsgError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.NetException" title="cup.err.NetException"><code class="xref py py-class docutils literal notranslate"><span class="pre">NetException</span></code></a></p>
<p>cup.net.async msg related Exception</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.BaseCupException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">BaseCupException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#BaseCupException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.BaseCupException" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>base cup Exception. All other cup Exceptions will inherit this.</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.ConfigError">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">ConfigError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#ConfigError"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.ConfigError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.DecoratorException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">DecoratorException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#DecoratorException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.DecoratorException" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.LockFileError">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">LockFileError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#LockFileError"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.LockFileError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.LoggerException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">LoggerException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#LoggerException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.LoggerException" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>Exception for logging, especially for cup.log</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.NetException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">NetException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#NetException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.NetException" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>Network releated Exception</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.NoSuchProcess">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">NoSuchProcess</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">str_process_name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#NoSuchProcess"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.NoSuchProcess" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.ResException" title="cup.err.ResException"><code class="xref py py-class docutils literal notranslate"><span class="pre">ResException</span></code></a></p>
<p>No such Process Exception</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.NotImplementedYet">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">NotImplementedYet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#NotImplementedYet"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.NotImplementedYet" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>Not implemented yet</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.NotSupportedError">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">NotSupportedError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">feature/functionality</span> <span class="pre">not</span> <span class="pre">implemented</span> <span class="pre">by</span> <span class="pre">code</span> <span class="pre">yet</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#NotSupportedError"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.NotSupportedError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.ResException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">ResException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#ResException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.ResException" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>Resource releated Exception</p>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="cup.err.ThreadTermException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.err.</span></span><span class="sig-name descname"><span class="pre">ThreadTermException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/err.html#ThreadTermException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.err.ThreadTermException" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.err.BaseCupException" title="cup.err.BaseCupException"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></p>
<p>Thread termination error</p>
</dd></dl>

</section>
<section id="module-cup.exfile">
<span id="cup-exfile-module"></span><h2>cup.exfile module<a class="headerlink" href="#module-cup.exfile" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>file related functions</p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.exfile.LockFile">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.exfile.</span></span><span class="sig-name descname"><span class="pre">LockFile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fpath</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">locktype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#LockFile"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.LockFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Lock file in order to prevent others from trying to lock it again</p>
<p>Code Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">exfile</span>

<span class="n">filelock</span> <span class="o">=</span> <span class="n">exfile</span><span class="o">.</span><span class="n">LockFile</span><span class="p">()</span>
<span class="c1"># xxxx do something</span>
<span class="n">filelock</span><span class="o">.</span><span class="n">lock</span><span class="p">(</span><span class="n">blocking</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="c1"># xxxxx do something else</span>
<span class="n">filelock</span><span class="o">.</span><span class="n">unlock</span><span class="p">()</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="cup.exfile.LockFile.filepath">
<span class="sig-name descname"><span class="pre">filepath</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#LockFile.filepath"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.LockFile.filepath" title="Permalink to this definition">¶</a></dt>
<dd><p>return filepath</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.exfile.LockFile.lock">
<span class="sig-name descname"><span class="pre">lock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">blocking</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#LockFile.lock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.LockFile.lock" title="Permalink to this definition">¶</a></dt>
<dd><p>lock the file</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>blocking</strong> – If blocking is True, will block there until cup gets the lock.
True by default.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>return False if locking fails</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>Exception</strong> – raise cup.err.LockFileError if blocking is False and
the lock action failed</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.exfile.LockFile.unlock">
<span class="sig-name descname"><span class="pre">unlock</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#LockFile.unlock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.LockFile.unlock" title="Permalink to this definition">¶</a></dt>
<dd><p>unlock the locked file</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.exfile.mk_newnode">
<span class="sig-prename descclassname"><span class="pre">cup.exfile.</span></span><span class="sig-name descname"><span class="pre">mk_newnode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">abspath</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">check_exsistence</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#mk_newnode"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.mk_newnode" title="Permalink to this definition">¶</a></dt>
<dd><p>make new file node for abspath</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>abspath</strong> – plz use absolute path. Not relative path</p></li>
<li><p><strong>check_exsistence</strong> – if True, will check if the abspath existence (
raise IOError if abspath exists)</p></li>
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>Exception</strong> – IOError</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.exfile.safe_delete">
<span class="sig-prename descclassname"><span class="pre">cup.exfile.</span></span><span class="sig-name descname"><span class="pre">safe_delete</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">abspath</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">not_del_list</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#safe_delete"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.safe_delete" title="Permalink to this definition">¶</a></dt>
<dd><p>the function will safely delete file/object of abspath.</p>
<p>If the abspath in not_del_list, safe delete will raise ValueError</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>abspath</strong> – pass in absolute path</p></li>
<li><p><strong>not_del_list</strong> – cannot del path list</p></li>
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>Exception</strong> – ValueError, if abspath is in exfile.CANNOT_DEL_PATHLIST or not_del_list
IOError, if cup encounters any problem</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.exfile.safe_rmtree">
<span class="sig-prename descclassname"><span class="pre">cup.exfile.</span></span><span class="sig-name descname"><span class="pre">safe_rmtree</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">abspath</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">not_del_list</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/exfile.html#safe_rmtree"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.exfile.safe_rmtree" title="Permalink to this definition">¶</a></dt>
<dd><p>the function will safely remove files/dirs of abspath with not_del_list
excluded</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>abspath</strong> – pass in absolute path</p></li>
<li><p><strong>not_del_list</strong> – cannot del path list</p></li>
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>Exception</strong> – ValueError, if abspath is in exfile.CANNOT_DEL_PATHLIST or not_del_list
IOError, if cup encounters any problem</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.flag">
<span id="cup-flag-module"></span><h2>cup.flag module<a class="headerlink" href="#module-cup.flag" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>TypeMan and FlagMan is for someone who looks up value by key and
the reverse (key by value)</p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.flag.BaseMan">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.flag.</span></span><span class="sig-name descname"><span class="pre">BaseMan</span></span><a class="reference internal" href="_modules/cup/flag.html#BaseMan"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.BaseMan" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>for netmsg types</p>
<dl class="py method">
<dt class="sig sig-object py" id="cup.flag.BaseMan.get_key_list">
<span class="sig-name descname"><span class="pre">get_key_list</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/flag.html#BaseMan.get_key_list"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.BaseMan.get_key_list" title="Permalink to this definition">¶</a></dt>
<dd><p>return key list</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.flag.BaseMan.getkey_bynumber">
<span class="sig-name descname"><span class="pre">getkey_bynumber</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">number</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/flag.html#BaseMan.getkey_bynumber"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.BaseMan.getkey_bynumber" title="Permalink to this definition">¶</a></dt>
<dd><p>get type by number</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.flag.BaseMan.getnumber_bykey">
<span class="sig-name descname"><span class="pre">getnumber_bykey</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/flag.html#BaseMan.getnumber_bykey"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.BaseMan.getnumber_bykey" title="Permalink to this definition">¶</a></dt>
<dd><p>get number by type</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.flag.BaseMan.register_types">
<span class="sig-name descname"><span class="pre">register_types</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">kvs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/flag.html#BaseMan.register_types"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.BaseMan.register_types" title="Permalink to this definition">¶</a></dt>
<dd><p>register types</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cup.flag.FlagMan">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.flag.</span></span><span class="sig-name descname"><span class="pre">FlagMan</span></span><a class="reference internal" href="_modules/cup/flag.html#FlagMan"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.FlagMan" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.flag.BaseMan" title="cup.flag.BaseMan"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseMan</span></code></a></p>
<p>msg flag class inherited from cup.flag.BaseMan inherited from
cup.flag.BaseMan</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cup.flag.TypeMan">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.flag.</span></span><span class="sig-name descname"><span class="pre">TypeMan</span></span><a class="reference internal" href="_modules/cup/flag.html#TypeMan"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.flag.TypeMan" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.flag.BaseMan" title="cup.flag.BaseMan"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseMan</span></code></a></p>
<p>msg flag class inherited from cup.flag.BaseMan</p>
</dd></dl>

</section>
<section id="module-cup.log">
<span id="cup-log-module"></span><h2>cup.log module<a class="headerlink" href="#module-cup.log" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>common log related module</p>
</dd>
</dl>
<dl class="py function">
<dt class="sig sig-object py" id="cup.log.backtrace_critical">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">backtrace_critical</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#backtrace_critical"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.backtrace_critical" title="Permalink to this definition">¶</a></dt>
<dd><p>logging.CRITICAL with backtrace support</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.backtrace_debug">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">backtrace_debug</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#backtrace_debug"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.backtrace_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>debug with backtrace support</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.backtrace_error">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">backtrace_error</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#backtrace_error"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.backtrace_error" title="Permalink to this definition">¶</a></dt>
<dd><p>error msg with backtarce support</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.backtrace_info">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">backtrace_info</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#backtrace_info"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.backtrace_info" title="Permalink to this definition">¶</a></dt>
<dd><p>info with backtrace support</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.critical">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">critical</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/logging.html#critical"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.critical" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity ‘CRITICAL’ on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.critical_if">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">critical_if</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#critical_if"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.critical_if" title="Permalink to this definition">¶</a></dt>
<dd><p>log msg with critical loglevel if bol is true</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.debug">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">debug</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/logging.html#debug"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity ‘DEBUG’ on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.debug_if">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">debug_if</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#debug_if"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.debug_if" title="Permalink to this definition">¶</a></dt>
<dd><p>log msg with critical loglevel if bol is true</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.error_if">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">error_if</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#error_if"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.error_if" title="Permalink to this definition">¶</a></dt>
<dd><p>log msg with error loglevel if bol is true</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.info">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/logging.html#info"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity ‘INFO’ on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.info_if">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">info_if</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#info_if"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.info_if" title="Permalink to this definition">¶</a></dt>
<dd><p>log msg with info loglevel if bol is true</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.init_comlog">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">init_comlog</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">20</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logfile</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'cup.log'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxlogsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1073741824</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bprint_console</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gen_wf</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#init_comlog"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.init_comlog" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize your default logger</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – Unique logger name for default logging.</p></li>
<li><p><strong>loglevel</strong> – 4 default levels: log.DEBUG log.INFO log.ERROR log.CRITICAL</p></li>
<li><p><strong>logfile</strong> – log file. Will try to create it if no existence</p></li>
<li><p><strong>logtype</strong> – <p>Two type candidiates: log.ROTATION and log.INFINITE</p>
<p>log.ROTATION will let logfile switch to a new one (30 files at most).
When logger reaches the 30th logfile, will overwrite from the
oldest to the most recent.</p>
<p>log.INFINITE will write on the logfile infinitely</p>
</p></li>
<li><p><strong>maxlogsize</strong> – maxmum log size with byte</p></li>
<li><p><strong>b_printcmd</strong> – print to stdout or not?</p></li>
<li><p><strong>gen_wf</strong> – print log msges with level &gt;= WARNING to file (${logfile}.wf)</p></li>
</ul>
</dd>
</dl>
<p><em>E.g.</em></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">log</span>
<span class="n">log</span><span class="o">.</span><span class="n">init_comlog</span><span class="p">(</span>
    <span class="s1">&#39;test&#39;</span><span class="p">,</span>
    <span class="n">log</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">,</span>
    <span class="s1">&#39;/home/work/test/test.log&#39;</span><span class="p">,</span>
    <span class="n">log</span><span class="o">.</span><span class="n">ROTATION</span><span class="p">,</span>
    <span class="mi">1024</span><span class="p">,</span>
    <span class="kc">False</span>
<span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">&#39;test xxx&#39;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s1">&#39;test critical&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.parse">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">parse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">logline</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#parse"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.parse" title="Permalink to this definition">¶</a></dt>
<dd><p>return a dict if the line is valid.
Otherwise, return None</p>
<dl class="field-list simple">
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>Exception</strong> – ValueError if logline is invalid</p>
</dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dict_info</span><span class="o">:=</span> <span class="p">{</span>
   <span class="s1">&#39;loglevel&#39;</span><span class="p">:</span> <span class="s1">&#39;DEBUG&#39;</span><span class="p">,</span>
   <span class="s1">&#39;date&#39;</span><span class="p">:</span> <span class="s1">&#39;2015-10-14&#39;</span><span class="p">,</span>
   <span class="s1">&#39;time&#39;</span><span class="p">:</span> <span class="s1">&#39;16:12:22,924&#39;</span><span class="p">,</span>
   <span class="s1">&#39;pid&#39;</span><span class="p">:</span> <span class="mi">8808</span><span class="p">,</span>
   <span class="s1">&#39;tid&#39;</span><span class="p">:</span> <span class="mi">1111111</span><span class="p">,</span>
   <span class="s1">&#39;srcline&#39;</span><span class="p">:</span> <span class="s1">&#39;util.py:33&#39;</span><span class="p">,</span>
   <span class="s1">&#39;msg&#39;</span><span class="p">:</span> <span class="s1">&#39;this is the log content&#39;</span><span class="p">,</span>
   <span class="s1">&#39;tznum&#39;</span><span class="p">:</span> <span class="mi">8</span><span class="p">,</span>
   <span class="s1">&#39;tzstr&#39;</span><span class="p">:</span> <span class="s1">&#39;CST&#39;</span>
<span class="p">}</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.reinit_comlog">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">reinit_comlog</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">20</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logfile</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'cup.log'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxlogsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1073741824</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bprint_console</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gen_wf</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#reinit_comlog"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.reinit_comlog" title="Permalink to this definition">¶</a></dt>
<dd><p>reinitialize default root logger for cup logging</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>loggername</strong> – logger name, should be different from the original one</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.setloglevel">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">setloglevel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">logginglevel</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#setloglevel"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.setloglevel" title="Permalink to this definition">¶</a></dt>
<dd><p>change log level during runtime</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">log</span>
<span class="n">log</span><span class="o">.</span><span class="n">setloglevel</span><span class="p">(</span><span class="n">log</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.warn_if">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">warn_if</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#warn_if"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.warn_if" title="Permalink to this definition">¶</a></dt>
<dd><p>log msg with error loglevel if bol is true</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.warning">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">warning</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/logging.html#warning"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message with severity ‘WARNING’ on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.xcritical">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">xcritical</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#xcritical"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.xcritical" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – shoule be xinit_comlog before calling xdebug/xinfo/xerror/xcritical</p></li>
<li><p><strong>msg</strong> – log msg</p></li>
</ul>
</dd>
<dt class="field-even">Back_trace_len<span class="colon">:</span></dt>
<dd class="field-even"><p>default 1, just ignore this param if you don’t know what it is.
This param will trace back 1 layer and get the
[code_filename:code_lines]</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.xdebug">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">xdebug</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#xdebug"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.xdebug" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – shoule be xinit_comlog before calling xdebug/xinfo/xerror/xcritical</p></li>
<li><p><strong>msg</strong> – log msg</p></li>
</ul>
</dd>
<dt class="field-even">Back_trace_len<span class="colon">:</span></dt>
<dd class="field-even"><p>1 by default, ignore this if you don’t need this</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.xerror">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">xerror</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#xerror"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.xerror" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – shoule be xinit_comlog before calling xdebug/xinfo/xerror/xcritical</p></li>
<li><p><strong>msg</strong> – log msg</p></li>
</ul>
</dd>
<dt class="field-even">Back_trace_len<span class="colon">:</span></dt>
<dd class="field-even"><p>default 1, just ignore this param if you don’t know what it is.
This param will trace back 1 layer and get the
[code_filename:code_lines]</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.xinfo">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">xinfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#xinfo"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.xinfo" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – shoule be xinit_comlog before calling xdebug/xinfo/xerror/xcritical</p></li>
<li><p><strong>msg</strong> – log msg</p></li>
</ul>
</dd>
<dt class="field-even">Back_trace_len<span class="colon">:</span></dt>
<dd class="field-even"><p>default 1, just ignore this param if you don’t know what it is.
This param will trace back 1 layer and get the
[code_filename:code_lines]</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.xinit_comlog">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">xinit_comlog</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logger_params</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#xinit_comlog"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.xinit_comlog" title="Permalink to this definition">¶</a></dt>
<dd><p>xinit_comlog along with xdebug xinfo xwarn xerror are functions for
different loggers other than logging.root (the global logger).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – loggername, example:  http.access,</p></li>
<li><p><strong>logger_params</strong> – object of LoggerParams</p></li>
</ul>
</dd>
</dl>
<p>Code example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">logparams</span> <span class="o">=</span> <span class="n">log</span><span class="o">.</span><span class="n">LoggerParams</span><span class="p">(</span>
    <span class="n">log</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">,</span> <span class="s1">&#39;cup.x.log&#39;</span><span class="p">,</span> <span class="n">log</span><span class="o">.</span><span class="n">ROTATION</span><span class="p">,</span> <span class="mi">100</span> <span class="o">*</span> <span class="mi">1024</span> <span class="o">*</span> <span class="mi">1024</span><span class="p">,</span>
    <span class="kc">True</span><span class="p">,</span> <span class="kc">True</span>
<span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xinit_comlog</span><span class="p">(</span><span class="s1">&#39;log.x&#39;</span><span class="p">,</span> <span class="n">logparams</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xdebug</span><span class="p">(</span><span class="s1">&#39;log.x&#39;</span><span class="p">,</span> <span class="s1">&#39;xdebug&#39;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xinfo</span><span class="p">(</span><span class="s1">&#39;log.x&#39;</span><span class="p">,</span> <span class="s1">&#39;xinfo&#39;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xerror</span><span class="p">(</span><span class="s1">&#39;log.x&#39;</span><span class="p">,</span> <span class="s1">&#39;xerror&#39;</span><span class="p">)</span>
<span class="n">logparams</span> <span class="o">=</span> <span class="n">log</span><span class="o">.</span><span class="n">LoggerParams</span><span class="p">(</span>
    <span class="n">log</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">,</span> <span class="s1">&#39;cup.y.log&#39;</span><span class="p">,</span> <span class="n">log</span><span class="o">.</span><span class="n">ROTATION</span><span class="p">,</span> <span class="mi">100</span> <span class="o">*</span> <span class="mi">1024</span> <span class="o">*</span> <span class="mi">1024</span><span class="p">,</span>
    <span class="kc">True</span><span class="p">,</span> <span class="kc">True</span>
<span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xinit_comlog</span><span class="p">(</span><span class="s1">&#39;log.y&#39;</span><span class="p">,</span> <span class="n">logparams</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xdebug</span><span class="p">(</span><span class="s1">&#39;log.y&#39;</span><span class="p">,</span> <span class="s1">&#39;ydebug&#39;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xinfo</span><span class="p">(</span><span class="s1">&#39;log.y&#39;</span><span class="p">,</span> <span class="s1">&#39;yinfo&#39;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">xerror</span><span class="p">(</span><span class="s1">&#39;log.y&#39;</span><span class="p">,</span> <span class="s1">&#39;yerror&#39;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.log.xwarn">
<span class="sig-prename descclassname"><span class="pre">cup.log.</span></span><span class="sig-name descname"><span class="pre">xwarn</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loggername</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">back_trace_len</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/log.html#xwarn"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.log.xwarn" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loggername</strong> – shoule be xinit_comlog before calling xdebug/xinfo/xerror/xcritical</p></li>
<li><p><strong>msg</strong> – log msg</p></li>
</ul>
</dd>
<dt class="field-even">Back_trace_len<span class="colon">:</span></dt>
<dd class="field-even"><p>default 1, just ignore this param if you don’t know what it is.
This param will trace back 1 layer and get the
[code_filename:code_lines]</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.mail">
<span id="cup-mail-module"></span><h2>cup.mail module<a class="headerlink" href="#module-cup.mail" title="Permalink to this heading">¶</a></h2>
<dl class="field-list">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>mail related modules.</p>
<p><strong>Recommand using SmtpMailer</strong></p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.mail.SmtpMailer">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.mail.</span></span><span class="sig-name descname"><span class="pre">SmtpMailer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sender</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">server</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">25</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_html</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/mail.html#SmtpMailer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.mail.SmtpMailer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sender</strong> – mail sender</p></li>
<li><p><strong>server</strong> – smtp的mailserver</p></li>
<li><p><strong>port</strong> – port</p></li>
<li><p><strong>is_html</strong> – is html enabled</p></li>
</ul>
</dd>
</dl>
<p>smtp server examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">mail</span>
<span class="n">mailer</span> <span class="o">=</span> <span class="n">mail</span><span class="o">.</span><span class="n">SmtpMailer</span><span class="p">(</span>
    <span class="s1">&#39;xxx@xxx.com&#39;</span><span class="p">,</span>
    <span class="s1">&#39;xxxx.smtp.xxx.com&#39;</span><span class="p">,</span>
    <span class="n">is_html</span><span class="o">=</span><span class="kc">True</span>
<span class="p">)</span>
<span class="c1"># if your smtp server needs login , pls uncomment line below:</span>
<span class="c1"># mailer.login(usernname, password)</span>
<span class="n">mailer</span><span class="o">.</span><span class="n">sendmail</span><span class="p">(</span>
    <span class="p">[</span>
        <span class="s1">&#39;maguannan&#39;</span><span class="p">,</span>
        <span class="s1">&#39;liuxuan05&#39;</span><span class="p">,</span>
        <span class="s1">&#39;zhaominghao&#39;</span>
    <span class="p">],</span>
    <span class="s1">&#39;test_img&#39;</span><span class="p">,</span>
    <span class="p">(</span>
        <span class="s1">&#39;testset &lt;img src=&quot;cid:screenshot.png&quot;&gt;&lt;/img&gt;&#39;</span>
    <span class="p">),</span>
    <span class="p">[</span>
        <span class="s1">&#39;/home/work/screenshot.png&#39;</span><span class="p">,</span>
        <span class="s1">&#39;../abc.zip&#39;</span>
    <span class="p">]</span>
<span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="cup.mail.SmtpMailer.login">
<span class="sig-name descname"><span class="pre">login</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">username</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">passwords</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/mail.html#SmtpMailer.login"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.mail.SmtpMailer.login" title="Permalink to this definition">¶</a></dt>
<dd><p>if the smtp need login, plz call this method before you call
sendmail</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.mail.SmtpMailer.sendmail">
<span class="sig-name descname"><span class="pre">sendmail</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">recipients</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">subject</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">body</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attachments</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bcc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/mail.html#SmtpMailer.sendmail"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.mail.SmtpMailer.sendmail" title="Permalink to this definition">¶</a></dt>
<dd><p>send mail</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>recipients</strong> – “list” of recipients. See the example above</p></li>
<li><p><strong>subject</strong> – subject</p></li>
<li><p><strong>body</strong> – body of the mail</p></li>
<li><p><strong>attachments</strong> – “list” of attachments. Plz use absolute file path!</p></li>
<li><p><strong>cc</strong> – cc list</p></li>
<li><p><strong>bcc</strong> – bcc list</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>return (True, None) on success, return (False, error_msg) otherwise</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.mail.SmtpMailer.setup">
<span class="sig-name descname"><span class="pre">setup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sender</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">server</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">25</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_html</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/mail.html#SmtpMailer.setup"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.mail.SmtpMailer.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>change parameters during run-time</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.mail.mutt_sendmail">
<span class="sig-prename descclassname"><span class="pre">cup.mail.</span></span><span class="sig-name descname"><span class="pre">mutt_sendmail</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tostr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">subject</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">body</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attach</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">content_is_html</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/mail.html#mutt_sendmail"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.mail.mutt_sendmail" title="Permalink to this definition">¶</a></dt>
<dd><p>Plz notice this function is not recommanded to use. Use SmtpMailer instead.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>exec_cwd</strong> – exec working directory. Plz use</p></li>
<li><p><strong>tostr</strong> – recipt list, separated by ,</p></li>
<li><p><strong>subject</strong> – subject</p></li>
<li><p><strong>body</strong> – email content</p></li>
<li><p><strong>attach</strong> – email attachment</p></li>
<li><p><strong>content_is_html</strong> – is htm mode opened</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>return True on success, False otherwise</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.platforms">
<span id="cup-platforms-module"></span><h2>cup.platforms module<a class="headerlink" href="#module-cup.platforms" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>cross-platform functions related module</p>
</dd>
</dl>
<dl class="py function">
<dt class="sig sig-object py" id="cup.platforms.is_linux">
<span class="sig-prename descclassname"><span class="pre">cup.platforms.</span></span><span class="sig-name descname"><span class="pre">is_linux</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/platforms.html#is_linux"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.platforms.is_linux" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if you are running on Linux.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>True or False</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.platforms.is_mac">
<span class="sig-prename descclassname"><span class="pre">cup.platforms.</span></span><span class="sig-name descname"><span class="pre">is_mac</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/platforms.html#is_mac"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.platforms.is_mac" title="Permalink to this definition">¶</a></dt>
<dd><p>is mac os</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.platforms.is_py2">
<span class="sig-prename descclassname"><span class="pre">cup.platforms.</span></span><span class="sig-name descname"><span class="pre">is_py2</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/platforms.html#is_py2"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.platforms.is_py2" title="Permalink to this definition">¶</a></dt>
<dd><p>is python 2.x</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.platforms.is_py3">
<span class="sig-prename descclassname"><span class="pre">cup.platforms.</span></span><span class="sig-name descname"><span class="pre">is_py3</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/platforms.html#is_py3"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.platforms.is_py3" title="Permalink to this definition">¶</a></dt>
<dd><p>is python 3.x</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.platforms.is_windows">
<span class="sig-prename descclassname"><span class="pre">cup.platforms.</span></span><span class="sig-name descname"><span class="pre">is_windows</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/platforms.html#is_windows"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.platforms.is_windows" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if you are running on Windows.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>True or False</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.thread">
<span id="cup-thread-module"></span><h2>cup.thread module<a class="headerlink" href="#module-cup.thread" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">description<span class="colon">:</span></dt>
<dd class="field-odd"><p>cup thread module</p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.thread.CupThread">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.thread.</span></span><span class="sig-name descname"><span class="pre">CupThread</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kwargs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">daemon</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#CupThread"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.CupThread" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></p>
<p>CupThread is a sub-class inherited from threading.Thread;</p>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>CupThread has 3 more methods:</p>
<ol class="arabic simple">
<li><p>raise_exc, to send a raise-exception signal to the thread,            TRY to let the thread raise an exception.</p></li>
<li><p>get_my_tid, get thread id</p></li>
<li><p>terminate, to stop the thread</p></li>
</ol>
</div>
<div class="admonition caution">
<p class="admonition-title">Caution</p>
<p>Notice if a thread is busy running under kernel-sysmode, it may not
response to the signals! In other words, it may not raise any
exception/terminate even though cup has send a CupThread signal!</p>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.CupThread.get_my_tid">
<span class="sig-name descname"><span class="pre">get_my_tid</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#CupThread.get_my_tid"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.CupThread.get_my_tid" title="Permalink to this definition">¶</a></dt>
<dd><p>return thread id</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.CupThread.raise_exc">
<span class="sig-name descname"><span class="pre">raise_exc</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exctype</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#CupThread.raise_exc"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.CupThread.raise_exc" title="Permalink to this definition">¶</a></dt>
<dd><p>asynchrously send ‘raise exception’ signal to the thread.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>exctype</strong> – raise Exception, exctype type is class</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>return 1 on success. 0 otherwise.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.CupThread.terminate">
<span class="sig-name descname"><span class="pre">terminate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">times</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">15</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#CupThread.terminate"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.CupThread.terminate" title="Permalink to this definition">¶</a></dt>
<dd><p>asynchrously terminate the thread.</p>
<p>Return True if the termination is successful or the thread is already
stopped. Return False, otherwise.</p>
<dl class="field-list simple">
<dt class="field-odd">Times<span class="colon">:</span></dt>
<dd class="field-odd"><p>retry times until call for failure.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cup.thread.RWLock">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.thread.</span></span><span class="sig-name descname"><span class="pre">RWLock</span></span><a class="reference internal" href="_modules/cup/thread.html#RWLock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.RWLock" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Read Write Lock is a typical lock type in computer world.</p>
<p>Code example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">thread</span>
<span class="n">rwlock</span> <span class="o">=</span> <span class="n">thread</span><span class="o">.</span><span class="n">RWLock</span><span class="p">()</span>
<span class="c1"># can acquire read lock</span>
<span class="n">rwlock</span><span class="o">.</span><span class="n">acquire_readlock</span><span class="p">()</span>
<span class="c1"># can acquire read lock again if there has not been WRITE locked</span>
<span class="n">rwlock</span><span class="o">.</span><span class="n">acquire_readlock</span><span class="p">()</span>   <span class="c1"># &lt;-- this will succeed</span>
<span class="c1"># rwlock.acquire_writelock()  # &lt;--- this will hang if uncommented</span>
<span class="n">rwlock</span><span class="o">.</span><span class="n">release_readlock</span><span class="p">()</span>
<span class="n">rwlock</span><span class="o">.</span><span class="n">acquire_writelock</span><span class="p">()</span>
<span class="c1"># rwlock.acquire_readlock() # &lt;--- this will hang if uncommented</span>
<span class="n">rwlock</span><span class="o">.</span><span class="n">release_writelock</span><span class="p">()</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.RWLock.acquire_readlock">
<span class="sig-name descname"><span class="pre">acquire_readlock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">wait_time</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#RWLock.acquire_readlock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.RWLock.acquire_readlock" title="Permalink to this definition">¶</a></dt>
<dd><p>Acquire readlock.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>wait_time</strong> – same to wait_time for acquire_writelock</p>
</dd>
<dt class="field-even">Raise<span class="colon">:</span></dt>
<dd class="field-even"><p>RuntimeError if after wait_time, cup still can NOT getthe lock</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.RWLock.acquire_writelock">
<span class="sig-name descname"><span class="pre">acquire_writelock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">wait_time</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#RWLock.acquire_writelock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.RWLock.acquire_writelock" title="Permalink to this definition">¶</a></dt>
<dd><p>Acquire write lock.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>If wait_time is not None and wait_time &gt;=0,
cup will wait until wait_time passes. If the call timeouts and
cannot get the lock, will raise RuntimeError</p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.RWLock.release_readlock">
<span class="sig-name descname"><span class="pre">release_readlock</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#RWLock.release_readlock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.RWLock.release_readlock" title="Permalink to this definition">¶</a></dt>
<dd><p>release read lock</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.thread.RWLock.release_writelock">
<span class="sig-name descname"><span class="pre">release_writelock</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#RWLock.release_writelock"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.RWLock.release_writelock" title="Permalink to this definition">¶</a></dt>
<dd><p>release write lock</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.thread.async_raise">
<span class="sig-prename descclassname"><span class="pre">cup.thread.</span></span><span class="sig-name descname"><span class="pre">async_raise</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exctype</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#async_raise"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.async_raise" title="Permalink to this definition">¶</a></dt>
<dd><p>Raises an exception in the threads with id tid</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tid</strong> – thread id in python</p></li>
<li><p><strong>exctype</strong> – exception class, e.g. IOError</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.thread.thread_alive">
<span class="sig-prename descclassname"><span class="pre">cup.thread.</span></span><span class="sig-name descname"><span class="pre">thread_alive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">obj</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/thread.html#thread_alive"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.thread.thread_alive" title="Permalink to this definition">¶</a></dt>
<dd><p>check if thread is alive. Py2 py3 compatible</p>
<dl class="field-list simple">
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>Exception</strong> – if the obejct does not have attr obj.is_alive and obj.isAlive,
the lib will raise ValueError</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.timeplus">
<span id="cup-timeplus-module"></span><h2>cup.timeplus module<a class="headerlink" href="#module-cup.timeplus" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">desc<span class="colon">:</span></dt>
<dd class="field-odd"><p>time related module. looking forward to accepting new patches</p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.timeplus.TimePlus">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.timeplus.</span></span><span class="sig-name descname"><span class="pre">TimePlus</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timezone</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#TimePlus"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.TimePlus" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>TimePlus can convert printable time from 1 timezone 2 another including
utc.</p>
<p>Code Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">print_function</span>
<span class="kn">from</span> <span class="nn">cup</span> <span class="kn">import</span> <span class="n">timeplus</span>
<span class="kn">import</span> <span class="nn">pytz</span>
<span class="n">tz_shanghai</span> <span class="o">=</span> <span class="n">pytz</span><span class="o">.</span><span class="n">timezone</span><span class="p">(</span><span class="s1">&#39;Aisa/Shanghai&#39;</span><span class="p">)</span>
<span class="n">tplus</span> <span class="o">=</span> <span class="n">timeplus</span><span class="o">.</span><span class="n">TimePlus</span><span class="p">(</span><span class="n">tz_shanghai</span><span class="p">)</span>
<span class="n">dtobj</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="n">tplus</span><span class="o">.</span><span class="n">utc2local</span><span class="p">(</span><span class="n">dtobj</span><span class="p">))</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="cup.timeplus.TimePlus.get_timezone">
<span class="sig-name descname"><span class="pre">get_timezone</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#TimePlus.get_timezone"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.TimePlus.get_timezone" title="Permalink to this definition">¶</a></dt>
<dd><p>return current pytz timezone object</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.timeplus.TimePlus.local2utc">
<span class="sig-name descname"><span class="pre">local2utc</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dateobj</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#TimePlus.local2utc"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.TimePlus.local2utc" title="Permalink to this definition">¶</a></dt>
<dd><p>local timezone to utc conversion</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>a datetime.datetime object with utc timezone enabled</p>
</dd>
<dt class="field-even">Raise<span class="colon">:</span></dt>
<dd class="field-even"><p>ValueError if dateobj is not a datetime.datetime object</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.timeplus.TimePlus.set_newtimezone">
<span class="sig-name descname"><span class="pre">set_newtimezone</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pytz_timezone</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#TimePlus.set_newtimezone"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.TimePlus.set_newtimezone" title="Permalink to this definition">¶</a></dt>
<dd><p>refresh timezone</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>True if refreshing is done. False otherwise</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.timeplus.TimePlus.utc2local">
<span class="sig-name descname"><span class="pre">utc2local</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dateobj</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#TimePlus.utc2local"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.TimePlus.utc2local" title="Permalink to this definition">¶</a></dt>
<dd><p>utc datetime to local timezone datetime.datetime</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.timeplus.TimePlus.utc_now">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">utc_now</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#TimePlus.utc_now"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.TimePlus.utc_now" title="Permalink to this definition">¶</a></dt>
<dd><p>return utc_now</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.timeplus.get_str_now">
<span class="sig-prename descclassname"><span class="pre">cup.timeplus.</span></span><span class="sig-name descname"><span class="pre">get_str_now</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fmt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'%Y-%m-%d-%H-%M-%S'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/timeplus.html#get_str_now"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.timeplus.get_str_now" title="Permalink to this definition">¶</a></dt>
<dd><p>return string of ‘now’</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>fmt</strong> – print-format, ‘%Y-%m-%d-%H-%M-%S’ by default</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-cup.unittest">
<span id="cup-unittest-module"></span><h2>cup.unittest module<a class="headerlink" href="#module-cup.unittest" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">desc<span class="colon">:</span></dt>
<dd class="field-odd"><p>unittest module</p>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="cup.unittest.CCaseExecutor">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">CCaseExecutor</span></span><a class="reference internal" href="_modules/cup/unittest.html#CCaseExecutor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CCaseExecutor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Executor class for executing CUTCase test cases. See the example below</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python</span>

<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">logging</span>

<span class="kn">import</span> <span class="nn">cup</span>
<span class="kn">import</span> <span class="nn">sb_global</span>

<span class="kn">from</span> <span class="nn">nfsinit</span> <span class="kn">import</span> <span class="n">CClearMan</span>
<span class="kn">from</span> <span class="nn">nfs</span> <span class="kn">import</span> <span class="n">CNfs</span>
<span class="kn">from</span> <span class="nn">cli</span> <span class="kn">import</span> <span class="n">CCli</span>

<span class="k">class</span> <span class="nc">TestMyCase</span><span class="p">(</span><span class="n">cup</span><span class="o">.</span><span class="n">unittest</span><span class="o">.</span><span class="n">CUTCase</span><span class="p">):</span>
    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span>
            <span class="n">logfile</span><span class="o">=</span><span class="n">sb_global</span><span class="o">.</span><span class="n">G_CASE_RUN_LOG</span><span class="p">,</span>
            <span class="n">b_logstd</span><span class="o">=</span><span class="kc">False</span>
        <span class="p">)</span>
        <span class="n">cup</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span> <span class="s1">&#39;Start to run &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="vm">__file__</span> <span class="p">)</span> <span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_cli</span> <span class="o">=</span> <span class="n">CCli</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_nfs</span> <span class="o">=</span> <span class="n">CNfs</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_uniq_strman</span> <span class="o">=</span> <span class="n">cup</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">CGeneratorMan</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_clearman</span> <span class="o">=</span> <span class="n">CClearMan</span><span class="p">()</span>

    <span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">str_uniq</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_uniq_strman</span><span class="o">.</span><span class="n">get_uniqname</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_workfolder</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">())</span>                     <span class="o">+</span> <span class="s1">&#39;/&#39;</span> <span class="o">+</span> <span class="n">str_uniq</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_work_remote_folder</span> <span class="o">=</span>                     <span class="bp">self</span><span class="o">.</span><span class="n">_nfs</span><span class="o">.</span><span class="n">translate_path_into_remote_under_rw_folder</span><span class="p">(</span>
            <span class="n">str_uniq</span>
            <span class="p">)</span>
        <span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_workfolder</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_clearman</span><span class="o">.</span><span class="n">addfolder</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_workfolder</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_check_filemd5</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">src</span><span class="p">,</span> <span class="n">dst</span><span class="p">):</span>
        <span class="n">ret</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s1">&#39;/usr/bin/diff --brief </span><span class="si">%s</span><span class="s1"> </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="n">dst</span><span class="p">)</span> <span class="p">)</span>
        <span class="n">cup</span><span class="o">.</span><span class="n">unittest</span><span class="o">.</span><span class="n">assert_eq</span><span class="p">(</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ret</span> <span class="p">)</span>

    <span class="k">def</span> <span class="nf">test_run</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="c1">#</span>
        <span class="c1"># @author: maguannan</span>
        <span class="c1">#</span>
        <span class="n">inited_bigfile</span> <span class="o">=</span> <span class="n">sb_global</span><span class="o">.</span><span class="n">G_NFS_DISK_RD</span> <span class="o">+</span>                     <span class="n">sb_global</span><span class="o">.</span><span class="n">G_TEST_BIGFILE</span>
        <span class="n">bigfile</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_workfolder</span> <span class="o">+</span>                     <span class="s1">&#39;/test_big_file_offsite_write_random_write&#39;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tmpfile</span> <span class="o">=</span> <span class="n">sb_global</span><span class="o">.</span><span class="n">G_TMP4USE</span> <span class="o">+</span>                     <span class="s1">&#39;/test_big_file_offsite_write_random_write&#39;</span>
        <span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span> <span class="s1">&#39;cp </span><span class="si">%s</span><span class="s1"> </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">inited_bigfile</span><span class="p">,</span> <span class="n">bigfile</span><span class="p">)</span> <span class="p">)</span>
        <span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span> <span class="s1">&#39;cp </span><span class="si">%s</span><span class="s1"> </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">bigfile</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">tmpfile</span><span class="p">)</span> <span class="p">)</span>
        <span class="n">times</span> <span class="o">=</span> <span class="mi">50</span>
        <span class="n">baseOffsite</span> <span class="o">=</span> <span class="mi">1000</span>
        <span class="n">fp0</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">bigfile</span><span class="p">,</span> <span class="s1">&#39;r+b&#39;</span><span class="p">)</span>
        <span class="n">fp1</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tmpfile</span><span class="p">,</span> <span class="s1">&#39;rb+&#39;</span><span class="p">)</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span> <span class="mi">0</span><span class="p">,</span> <span class="n">times</span> <span class="p">):</span>
            <span class="n">fp0</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="n">baseOffsite</span><span class="p">)</span>
            <span class="n">fp1</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="n">baseOffsite</span><span class="p">)</span>
            <span class="n">fp0</span><span class="o">.</span><span class="n">write</span><span class="p">(</span> <span class="s1">&#39;a&#39;</span> <span class="o">*</span> <span class="mi">100</span> <span class="p">)</span>
            <span class="n">fp1</span><span class="o">.</span><span class="n">write</span><span class="p">(</span> <span class="s1">&#39;a&#39;</span> <span class="o">*</span> <span class="mi">100</span> <span class="p">)</span>
            <span class="n">baseOffsite</span> <span class="o">+=</span> <span class="mi">1000</span>
        <span class="n">fp0</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
        <span class="n">fp1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_check_filemd5</span><span class="p">(</span><span class="n">bigfile</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">tmpfile</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">teardown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_result</span><span class="p">():</span>
            <span class="c1"># if case succeeded, do sth</span>
            <span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tmpfile</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_clearman</span><span class="o">.</span><span class="n">teardown</span><span class="p">()</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="c1"># if case failed, do sth else.</span>
            <span class="nb">print</span> <span class="s1">&#39;failed&#39;</span>
        <span class="n">cup</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span> <span class="s1">&#39;End running &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="vm">__file__</span> <span class="p">)</span> <span class="p">)</span>

<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
    <span class="n">cup</span><span class="o">.</span><span class="n">unittest</span><span class="o">.</span><span class="n">CCaseExecutor</span><span class="p">()</span><span class="o">.</span><span class="n">runcase</span><span class="p">(</span><span class="n">TestMyCase</span><span class="p">())</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="cup.unittest.CCaseExecutor.runcase">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">runcase</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">case</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CCaseExecutor.runcase"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CCaseExecutor.runcase" title="Permalink to this definition">¶</a></dt>
<dd><p>run the case</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cup.unittest.CUTCase">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">CUTCase</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">logfile</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./test.log'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b_logstd</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b_debug</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CUTCase"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CUTCase" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>CUTCase is compatible with nosetests. You can inherit this class
and implement your own TestClass.</p>
<p>Notice class method [set_result] will set case status to True/False after
executing the case. Then you can get case status in teardown through
calling class method [get_result]</p>
<dl class="py method">
<dt class="sig sig-object py" id="cup.unittest.CUTCase.get_result">
<span class="sig-name descname"><span class="pre">get_result</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CUTCase.get_result"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CUTCase.get_result" title="Permalink to this definition">¶</a></dt>
<dd><p>get case status during case teardown</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.unittest.CUTCase.set_result">
<span class="sig-name descname"><span class="pre">set_result</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">b_result</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CUTCase.set_result"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CUTCase.set_result" title="Permalink to this definition">¶</a></dt>
<dd><p>set case running status</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.unittest.CUTCase.setup">
<span class="sig-name descname"><span class="pre">setup</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CUTCase.setup"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CUTCase.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>set up</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.unittest.CUTCase.teardown">
<span class="sig-name descname"><span class="pre">teardown</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CUTCase.teardown"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CUTCase.teardown" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cup.unittest.CUTCase.test_run">
<span class="sig-name descname"><span class="pre">test_run</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#CUTCase.test_run"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.CUTCase.test_run" title="Permalink to this definition">¶</a></dt>
<dd><p>test_run function</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_eq">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_eq</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_eq"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_eq" title="Permalink to this definition">¶</a></dt>
<dd><p>if val != exp, aseert False and print errmsg</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_eq_one">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_eq_one</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">array</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_eq_one"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_eq_one" title="Permalink to this definition">¶</a></dt>
<dd><p>assert val equals one of the items in the [array]</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_false">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_false</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_false"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_false" title="Permalink to this definition">¶</a></dt>
<dd><p>val should be False. Assert False otherwise.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_ge">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_ge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_ge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_ge" title="Permalink to this definition">¶</a></dt>
<dd><p>expect val &gt;= exp</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_gt">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_gt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_gt"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_gt" title="Permalink to this definition">¶</a></dt>
<dd><p>assert_gt, expect val &gt; exp</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_le">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_le</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_le"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_le" title="Permalink to this definition">¶</a></dt>
<dd><p>expect val &lt;= exp</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_lt">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_lt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_lt"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_lt" title="Permalink to this definition">¶</a></dt>
<dd><p>assert_lt, expect val &lt; exp</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_ne">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_ne</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_ne"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_ne" title="Permalink to this definition">¶</a></dt>
<dd><p>expect val != exp</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_not_eq">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_not_eq</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_not_eq"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_not_eq" title="Permalink to this definition">¶</a></dt>
<dd><p>assert not equal to</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.assert_true">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">assert_true</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errmsg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#assert_true"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.assert_true" title="Permalink to this definition">¶</a></dt>
<dd><p>If val is not True, assert False and print to stdout.</p>
<p>Plz notice, log.critical(errmsg) will be invoked if logging system has
been initialized with cup.log.init_comlog.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cup.unittest.expect_raise">
<span class="sig-prename descclassname"><span class="pre">cup.unittest.</span></span><span class="sig-name descname"><span class="pre">expect_raise</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exception</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">argc</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cup/unittest.html#expect_raise"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cup.unittest.expect_raise" title="Permalink to this definition">¶</a></dt>
<dd><p>expect raise exception</p>
</dd></dl>

</section>
<section id="module-cup.version">
<span id="cup-version-module"></span><h2>cup.version module<a class="headerlink" href="#module-cup.version" title="Permalink to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">desc<span class="colon">:</span></dt>
<dd class="field-odd"><p>CUP version for Programming Use Only.</p>
</dd>
</dl>
</section>
</section>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">cup</a></h1>








<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">cup package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cup.net.html">cup.net package</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.res.html">cup.res package</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.services.html">cup.services package</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.shell.html">cup.shell package</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.storage.html">cup.storage package</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.util.html">cup.util package</a></li>
<li class="toctree-l3"><a class="reference internal" href="cup.web.html">cup.web package</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.cache">cup.cache module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.cache.CacheFull"><code class="docutils literal notranslate"><span class="pre">CacheFull</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.cache.KVCache"><code class="docutils literal notranslate"><span class="pre">KVCache</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.INFINITE_TIME"><code class="docutils literal notranslate"><span class="pre">KVCache.INFINITE_TIME</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.TIME_EXTENSION"><code class="docutils literal notranslate"><span class="pre">KVCache.TIME_EXTENSION</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.clear"><code class="docutils literal notranslate"><span class="pre">KVCache.clear()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.get"><code class="docutils literal notranslate"><span class="pre">KVCache.get()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.pop_n_expired"><code class="docutils literal notranslate"><span class="pre">KVCache.pop_n_expired()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.set"><code class="docutils literal notranslate"><span class="pre">KVCache.set()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.set_time_extension"><code class="docutils literal notranslate"><span class="pre">KVCache.set_time_extension()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.cache.KVCache.size"><code class="docutils literal notranslate"><span class="pre">KVCache.size()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.cache.KvCache"><code class="docutils literal notranslate"><span class="pre">KvCache</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.const">cup.const module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.const.ConstError"><code class="docutils literal notranslate"><span class="pre">ConstError</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.decorators">cup.decorators module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.decorators.Singleton"><code class="docutils literal notranslate"><span class="pre">Singleton</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.decorators.TraceUsedTime"><code class="docutils literal notranslate"><span class="pre">TraceUsedTime</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.decorators.needlinux"><code class="docutils literal notranslate"><span class="pre">needlinux()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.decorators.needmac"><code class="docutils literal notranslate"><span class="pre">needmac()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.decorators.needposix"><code class="docutils literal notranslate"><span class="pre">needposix()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.decorators.py_versioncheck"><code class="docutils literal notranslate"><span class="pre">py_versioncheck()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.err">cup.err module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.AccessDenied"><code class="docutils literal notranslate"><span class="pre">AccessDenied</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.AsyncMsgError"><code class="docutils literal notranslate"><span class="pre">AsyncMsgError</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.BaseCupException"><code class="docutils literal notranslate"><span class="pre">BaseCupException</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.ConfigError"><code class="docutils literal notranslate"><span class="pre">ConfigError</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.DecoratorException"><code class="docutils literal notranslate"><span class="pre">DecoratorException</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.LockFileError"><code class="docutils literal notranslate"><span class="pre">LockFileError</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.LoggerException"><code class="docutils literal notranslate"><span class="pre">LoggerException</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.NetException"><code class="docutils literal notranslate"><span class="pre">NetException</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.NoSuchProcess"><code class="docutils literal notranslate"><span class="pre">NoSuchProcess</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.NotImplementedYet"><code class="docutils literal notranslate"><span class="pre">NotImplementedYet</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.NotSupportedError"><code class="docutils literal notranslate"><span class="pre">NotSupportedError</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.ResException"><code class="docutils literal notranslate"><span class="pre">ResException</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.err.ThreadTermException"><code class="docutils literal notranslate"><span class="pre">ThreadTermException</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.exfile">cup.exfile module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.exfile.LockFile"><code class="docutils literal notranslate"><span class="pre">LockFile</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.exfile.LockFile.filepath"><code class="docutils literal notranslate"><span class="pre">LockFile.filepath()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.exfile.LockFile.lock"><code class="docutils literal notranslate"><span class="pre">LockFile.lock()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.exfile.LockFile.unlock"><code class="docutils literal notranslate"><span class="pre">LockFile.unlock()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.exfile.mk_newnode"><code class="docutils literal notranslate"><span class="pre">mk_newnode()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.exfile.safe_delete"><code class="docutils literal notranslate"><span class="pre">safe_delete()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.exfile.safe_rmtree"><code class="docutils literal notranslate"><span class="pre">safe_rmtree()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.flag">cup.flag module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.flag.BaseMan"><code class="docutils literal notranslate"><span class="pre">BaseMan</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.flag.BaseMan.get_key_list"><code class="docutils literal notranslate"><span class="pre">BaseMan.get_key_list()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.flag.BaseMan.getkey_bynumber"><code class="docutils literal notranslate"><span class="pre">BaseMan.getkey_bynumber()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.flag.BaseMan.getnumber_bykey"><code class="docutils literal notranslate"><span class="pre">BaseMan.getnumber_bykey()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.flag.BaseMan.register_types"><code class="docutils literal notranslate"><span class="pre">BaseMan.register_types()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.flag.FlagMan"><code class="docutils literal notranslate"><span class="pre">FlagMan</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.flag.TypeMan"><code class="docutils literal notranslate"><span class="pre">TypeMan</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.log">cup.log module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.backtrace_critical"><code class="docutils literal notranslate"><span class="pre">backtrace_critical()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.backtrace_debug"><code class="docutils literal notranslate"><span class="pre">backtrace_debug()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.backtrace_error"><code class="docutils literal notranslate"><span class="pre">backtrace_error()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.backtrace_info"><code class="docutils literal notranslate"><span class="pre">backtrace_info()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.critical"><code class="docutils literal notranslate"><span class="pre">critical()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.critical_if"><code class="docutils literal notranslate"><span class="pre">critical_if()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.debug"><code class="docutils literal notranslate"><span class="pre">debug()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.debug_if"><code class="docutils literal notranslate"><span class="pre">debug_if()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.error_if"><code class="docutils literal notranslate"><span class="pre">error_if()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.info"><code class="docutils literal notranslate"><span class="pre">info()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.info_if"><code class="docutils literal notranslate"><span class="pre">info_if()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.init_comlog"><code class="docutils literal notranslate"><span class="pre">init_comlog()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.parse"><code class="docutils literal notranslate"><span class="pre">parse()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.reinit_comlog"><code class="docutils literal notranslate"><span class="pre">reinit_comlog()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.setloglevel"><code class="docutils literal notranslate"><span class="pre">setloglevel()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.warn_if"><code class="docutils literal notranslate"><span class="pre">warn_if()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.warning"><code class="docutils literal notranslate"><span class="pre">warning()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.xcritical"><code class="docutils literal notranslate"><span class="pre">xcritical()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.xdebug"><code class="docutils literal notranslate"><span class="pre">xdebug()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.xerror"><code class="docutils literal notranslate"><span class="pre">xerror()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.xinfo"><code class="docutils literal notranslate"><span class="pre">xinfo()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.xinit_comlog"><code class="docutils literal notranslate"><span class="pre">xinit_comlog()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.log.xwarn"><code class="docutils literal notranslate"><span class="pre">xwarn()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.mail">cup.mail module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.mail.SmtpMailer"><code class="docutils literal notranslate"><span class="pre">SmtpMailer</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.mail.SmtpMailer.login"><code class="docutils literal notranslate"><span class="pre">SmtpMailer.login()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.mail.SmtpMailer.sendmail"><code class="docutils literal notranslate"><span class="pre">SmtpMailer.sendmail()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.mail.SmtpMailer.setup"><code class="docutils literal notranslate"><span class="pre">SmtpMailer.setup()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.mail.mutt_sendmail"><code class="docutils literal notranslate"><span class="pre">mutt_sendmail()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.platforms">cup.platforms module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.platforms.is_linux"><code class="docutils literal notranslate"><span class="pre">is_linux()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.platforms.is_mac"><code class="docutils literal notranslate"><span class="pre">is_mac()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.platforms.is_py2"><code class="docutils literal notranslate"><span class="pre">is_py2()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.platforms.is_py3"><code class="docutils literal notranslate"><span class="pre">is_py3()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.platforms.is_windows"><code class="docutils literal notranslate"><span class="pre">is_windows()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.thread">cup.thread module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.thread.CupThread"><code class="docutils literal notranslate"><span class="pre">CupThread</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.CupThread.get_my_tid"><code class="docutils literal notranslate"><span class="pre">CupThread.get_my_tid()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.CupThread.raise_exc"><code class="docutils literal notranslate"><span class="pre">CupThread.raise_exc()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.CupThread.terminate"><code class="docutils literal notranslate"><span class="pre">CupThread.terminate()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.thread.RWLock"><code class="docutils literal notranslate"><span class="pre">RWLock</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.RWLock.acquire_readlock"><code class="docutils literal notranslate"><span class="pre">RWLock.acquire_readlock()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.RWLock.acquire_writelock"><code class="docutils literal notranslate"><span class="pre">RWLock.acquire_writelock()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.RWLock.release_readlock"><code class="docutils literal notranslate"><span class="pre">RWLock.release_readlock()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.thread.RWLock.release_writelock"><code class="docutils literal notranslate"><span class="pre">RWLock.release_writelock()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.thread.async_raise"><code class="docutils literal notranslate"><span class="pre">async_raise()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.thread.thread_alive"><code class="docutils literal notranslate"><span class="pre">thread_alive()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.timeplus">cup.timeplus module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.timeplus.TimePlus"><code class="docutils literal notranslate"><span class="pre">TimePlus</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.timeplus.TimePlus.get_timezone"><code class="docutils literal notranslate"><span class="pre">TimePlus.get_timezone()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.timeplus.TimePlus.local2utc"><code class="docutils literal notranslate"><span class="pre">TimePlus.local2utc()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.timeplus.TimePlus.set_newtimezone"><code class="docutils literal notranslate"><span class="pre">TimePlus.set_newtimezone()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.timeplus.TimePlus.utc2local"><code class="docutils literal notranslate"><span class="pre">TimePlus.utc2local()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.timeplus.TimePlus.utc_now"><code class="docutils literal notranslate"><span class="pre">TimePlus.utc_now()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.timeplus.get_str_now"><code class="docutils literal notranslate"><span class="pre">get_str_now()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.unittest">cup.unittest module</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.CCaseExecutor"><code class="docutils literal notranslate"><span class="pre">CCaseExecutor</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.unittest.CCaseExecutor.runcase"><code class="docutils literal notranslate"><span class="pre">CCaseExecutor.runcase()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.CUTCase"><code class="docutils literal notranslate"><span class="pre">CUTCase</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cup.unittest.CUTCase.get_result"><code class="docutils literal notranslate"><span class="pre">CUTCase.get_result()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.unittest.CUTCase.set_result"><code class="docutils literal notranslate"><span class="pre">CUTCase.set_result()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.unittest.CUTCase.setup"><code class="docutils literal notranslate"><span class="pre">CUTCase.setup()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.unittest.CUTCase.teardown"><code class="docutils literal notranslate"><span class="pre">CUTCase.teardown()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cup.unittest.CUTCase.test_run"><code class="docutils literal notranslate"><span class="pre">CUTCase.test_run()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_eq"><code class="docutils literal notranslate"><span class="pre">assert_eq()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_eq_one"><code class="docutils literal notranslate"><span class="pre">assert_eq_one()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_false"><code class="docutils literal notranslate"><span class="pre">assert_false()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_ge"><code class="docutils literal notranslate"><span class="pre">assert_ge()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_gt"><code class="docutils literal notranslate"><span class="pre">assert_gt()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_le"><code class="docutils literal notranslate"><span class="pre">assert_le()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_lt"><code class="docutils literal notranslate"><span class="pre">assert_lt()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_ne"><code class="docutils literal notranslate"><span class="pre">assert_ne()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_not_eq"><code class="docutils literal notranslate"><span class="pre">assert_not_eq()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.assert_true"><code class="docutils literal notranslate"><span class="pre">assert_true()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#cup.unittest.expect_raise"><code class="docutils literal notranslate"><span class="pre">expect_raise()</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#module-cup.version">cup.version module</a></li>
</ul>
</li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="index.html" title="previous chapter">Welcome to cup’s documentation!</a></li>
      <li>Next: <a href="cup.net.html" title="next chapter">cup.net package</a></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2023, CUP-DEV Team.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 7.0.1</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
      
      |
      <a href="_sources/cup.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>